package com.freewater.library.lending.book.presentation.request;

import com.freewater.library.lending.book.application.command.CheckOutBookInstanceCommand;
import io.swagger.v3.oas.annotations.Parameter;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

@Data
public class CheckOutBookInstanceRequest {
    @Parameter(description = "二维码")
    @NotBlank(message = "二维码不能为空")
    private String qrCode;

    @Parameter(description = "读者Id")
    @NotNull(message = "读者Id不能为空")
    private Long readerId;

    public CheckOutBookInstanceCommand toCommand() {
        return new CheckOutBookInstanceCommand(this.qrCode, this.readerId);
    }
}
